﻿unit uViDef;

interface

uses
  DLDatObj, DLDatLst, DLRttiDatObj;

const
  mcWalkUpToIndex = 35; //全局，但只在本模块使用

type
  TVehicleWalkUpToItem = class(TDLCustomRttiDataObject)
  private
    tvCityName: AnsiString;
    tvToCityCode: LongInt;
  published
    property ToCityCode: LongInt //城市代码（省代码2位 + 城市代码5位，或者省代码2位 + 5个0表示整个省份）
      index 2 read tvToCityCode write tvToCityCode;
    property CityName: AnsiString //50 城市名称
      index 3 read tvCityName write tvCityName;
  end;

  TVehicleWalkUpToList = class(TDLCustomDataList)
  protected
    function NewItem: TDLCustomDataObject; override;
  end;

  TVehicleItem = class(TDLCustomRttiDataObject)
  private
    tvCar_AddTime: TDateTime;
    tvDingWeiShiJian: TDateTime;
    tvOwnerUserName, tvOwnerCityName, tvOwnerCorp, tvOwnerTel, tvOwnerMobile: AnsiString;
    tvChePaiHaoMa: AnsiString;
    tvCheXing, tvCheZhang, tvCheKuan, tvCheGao, tvDunWei, tvRongJi: AnsiString;
    tvFaDongJiHao, tvCheJiaHaoMa: AnsiString;
    tvBaoXianKaHao: AnsiString;
    tvCheZhuXingMing, tvCheZhuShenFenZhengHao: AnsiString;
    tvCheZhuXingBie, tvCheZhuJiaTingZhuZhi: AnsiString;
    tvCheZhuShouJi, tvCheZhuDianHuaHaoMa, tvCheZhuQiTaDianHua: AnsiString;
    tvGuaKaoDanWei, tvYunYingZhengShu: AnsiString;
    tvSiJiXingMing, tvSiJiShenFenZhengHao, tvJiaShiZhiZhao: AnsiString;
    tvSiJiXingBie, tvSiJiJiaTingZhuZhi, tvCheLiangWeiZhi2: AnsiString;
    tvSuiCheShouJi, tvSiJiJiaTingDianHua, tvSiJiQiTaDianHua: AnsiString;
    tvHuoYunZhuangTai: AnsiString;
    tvQiWangLiuXiang: AnsiString;
    tvJingDu, tvWeiDu, tvCheLiangWeiZhi, tvWeiZhiMiaoShu: AnsiString;
    tvBeiZhu: AnsiString;
    tvWalkUpTo: TVehicleWalkUpToList;
    tvCheLiangBianHao: LongInt;
    tvSuoShuYongHu, tvOwnerCityCode: LongInt;
    tvZhuCeFou: LongInt;
    tvErrorCode: LongInt;
    tvCityCode: LongInt;
    tvCar_Del: LongInt;
    tvCar_InfoType: LongInt;
    tvCar_Source: ShortInt;
    tvCar_IsGift: ShortInt;
    tvAutoLocTime: ShortInt;
    procedure SetWalkUpTo(avIndex: LongInt; avValue: TVehicleWalkUpToList);
  public
    constructor Create;
    destructor Destroy; override;
  published
    property CheLiangBianHao: LongInt //车辆编号，自增ID
      index 1 read tvCheLiangBianHao write tvCheLiangBianHao;
    property SuoShuYongHu: LongInt //所属用户，编号，外键关联 Users.Use_ID字段
      index 2 read tvSuoShuYongHu write tvSuoShuYongHu;

    //以下为服务端自动更新字段
    property OwnerUserName: AnsiString
      index 3 read tvOwnerUserName write tvOwnerUserName;
    property OwnerCityCode: LongInt
      index 4 read tvOwnerCityCode write tvOwnerCityCode;
    property OwnerCityName: AnsiString
      index 5 read tvOwnerCityName write tvOwnerCityName;
    property OwnerCorp: AnsiString
      index 6 read tvOwnerCorp write tvOwnerCorp;
    property OwnerTel: AnsiString
      index 7 read tvOwnerTel write tvOwnerTel;
    property OwnerMobile: AnsiString
      index 8 read tvOwnerMobile write tvOwnerMobile;
    //自动更新字段结束

    property Car_InfoType: LongInt //=1
      index 11 read tvCar_InfoType write tvCar_InfoType;
    property Car_Source: ShortInt //=1
      index 12 read tvCar_Source write tvCar_Source;
    {
    Car_InfoType = 1
      Car_Source = 1 共享车队
      Car_Source = 2 共享车辆
    Car_InfoType = 2 关爱星
    Car_InfoType = 3 我的车队
    }

    property ChePaiHaoMa: AnsiString //100 车牌号
      index 21 read tvChePaiHaoMa write tvChePaiHaoMa;
    property CheXing: AnsiString //100 车型。以逗号分隔的拖挂轮轴，货箱结构，特殊功能，厂商品牌信息
      index 22 read tvCheXing write tvCheXing;
    property CheZhang: AnsiString //10 车长
      index 23 read tvCheZhang write tvCheZhang;
    property CheKuan: AnsiString //10 车宽
      index 24 read tvCheKuan write tvCheKuan;
    property CheGao: AnsiString //10 车高
      index 25 read tvCheGao write tvCheGao;
    property DunWei: AnsiString //20 吨位
      index 26 read tvDunWei write tvDunWei;
    property RongJi: AnsiString //50 容积
      index 27 read tvRongJi write tvRongJi;
    property FaDongJiHao: AnsiString //40 发动机号码
      index 28 read tvFaDongJiHao write tvFaDongJiHao;
    property CheJiaHaoMa: AnsiString //40 车架号码
      index 29 read tvCheJiaHaoMa write tvCheJiaHaoMa;
    property BaoXianKaHao: AnsiString //40 保险卡号
      index 30 read tvBaoXianKaHao write tvBaoXianKaHao;
    property GuaKaoDanWei: AnsiString //100 挂靠单位
      index 31 read tvGuaKaoDanWei write tvGuaKaoDanWei;
    property YunYingZhengShu: AnsiString //40 运营证书
      index 32 read tvYunYingZhengShu write tvYunYingZhengShu;
    property HuoYunZhuangTai: AnsiString //10 货运状态。有空车，途中，已出发，已到达，故障，解除故障，回程几种
      index 33 read tvHuoYunZhuangTai write tvHuoYunZhuangTai;
    property QiWangLiuXiang: AnsiString //500 期望流向。以逗号分隔的省市名称列表 *客户端显示 关联表用来搜索
      index 34 read tvQiWangLiuXiang write tvQiWangLiuXiang;
    property WalkUpTo: TVehicleWalkUpToList
      index mcWalkUpToIndex read tvWalkUpTo write SetWalkUpTo;

    property CheZhuXingMing: AnsiString //20 车主姓名
      index 60 read tvCheZhuXingMing write tvCheZhuXingMing;
    property CheZhuShouJi: AnsiString //15 车主手机号码
      index 61 read tvCheZhuShouJi write tvCheZhuShouJi;
    property CheZhuShenFenZhengHao: AnsiString //20 车主身份证号码
      index 62 read tvCheZhuShenFenZhengHao write tvCheZhuShenFenZhengHao;
    property CheZhuXingBie: AnsiString //50 车主性别
      index 63 read tvCheZhuXingBie write tvCheZhuXingBie;
    property CheZhuDianHuaHaoMa: AnsiString //20 车主固定电话号码
      index 64 read tvCheZhuDianHuaHaoMa write tvCheZhuDianHuaHaoMa;
    property CheZhuQiTaDianHua: AnsiString //20 车主其它电话
      index 65 read tvCheZhuQiTaDianHua write tvCheZhuQiTaDianHua;
    property CheZhuJiaTingZhuZhi: AnsiString //100 车主家庭住址
      index 66 read tvCheZhuJiaTingZhuZhi write tvCheZhuJiaTingZhuZhi;

    property SiJiXingMing: AnsiString //50 司机姓名
      index 70 read tvSiJiXingMing write tvSiJiXingMing;
    property SuiCheShouJi: AnsiString //15 随车手机
      index 71 read tvSuiCheShouJi write tvSuiCheShouJi;
    property CheLiangWeiZhi2: AnsiString //80 *固定：随车手机的所属地
      index 72 read tvCheLiangWeiZhi2 write tvCheLiangWeiZhi2;
    property SiJiShenFenZhengHao: AnsiString //20 司机身份证号码
      index 73 read tvSiJiShenFenZhengHao write tvSiJiShenFenZhengHao;
    property SiJiXingBie: AnsiString //50 司机性别
      index 74 read tvSiJiXingBie write tvSiJiXingBie;
    property JiaShiZhiZhao: AnsiString //50 驾驶执照
      index 75 read tvJiaShiZhiZhao write tvJiaShiZhiZhao;
    property SiJiJiaTingDianHua: AnsiString //20 司机家庭电话
      index 76 read tvSiJiJiaTingDianHua write tvSiJiJiaTingDianHua;
    property SiJiQiTaDianHua: AnsiString //20 司机其它电话
      index 77 read tvSiJiQiTaDianHua write tvSiJiQiTaDianHua;
    property SiJiJiaTingZhuZhi: AnsiString //100 司机家庭住址
      index 78 read tvSiJiJiaTingZhuZhi write tvSiJiJiaTingZhuZhi;

    property ZhuCeFou: LongInt //定位服务状态。未开通-1，开通中1（鉴权短信已发送，但尚未回复），已开通3
      index 80 read tvZhuCeFou write tvZhuCeFou;
    property AutoLocTime: Shortint //=7 自动定位的时间。0～23
      index 81 read tvAutoLocTime write tvAutoLocTime;
    property DingWeiShiJian: TDateTime //最后定位时间
      index 82 read tvDingWeiShiJian write tvDingWeiShiJian;
    property ErrorCode: LongInt //定位错误码
      index 88 read tvErrorCode write tvErrorCode;
    property JingDu: AnsiString //50 当前经度
      index 83 read tvJingDu write tvJingDu;
    property WeiDu: AnsiString //50 当前纬度
      index 84 read tvWeiDu write tvWeiDu;
    property CheLiangWeiZhi: AnsiString //80 当前位置（省市）
      index 85 read tvCheLiangWeiZhi write tvCheLiangWeiZhi;
    property WeiZhiMiaoShu: AnsiString //80 当前位置（详细）
      index 86 read tvWeiZhiMiaoShu write tvWeiZhiMiaoShu;
    property CityCode: LongInt //当前所在城市的代码
      index 87 read tvCityCode write tvCityCode;

    property Car_AddTime: TDateTime //添加车辆的时间
      index 90 read tvCar_AddTime write tvCar_AddTime;
    property Car_IsGift: ShortInt //=0 定位点数赠送标记。置1表示已赠送点数，不可重复赠送
      index 91 read tvCar_IsGift write tvCar_IsGift;
    property BeiZhu: AnsiString //备注
      index 92 read tvBeiZhu write tvBeiZhu;
    property Car_Del: LongInt //=0 删除标记，置1表示已删除 *逻辑删除，下次添加同一手机时恢复记录，重用手机的开通状态
      index 99 read tvCar_Del write tvCar_Del;
  end;

  TVehicleList = class(TDLCustomDataList)
  protected
    function NewItem: TDLCustomDataObject; override;
  end;

implementation

{ TVehicleWalkUpToList }

function TVehicleWalkUpToList.NewItem: TDLCustomDataObject;
begin
  Result := TVehicleWalkUpToItem.Create;
end;

{ TVehicleItem }

constructor TVehicleItem.Create;
begin
  inherited;
  Self.tvWalkUpTo := TVehicleWalkUpToList.Create;
  Self.tvCar_InfoType := 1;
  Self.tvCar_Source := 1;
  Self.tvAutoLocTime := 7;
end;

destructor TVehicleItem.Destroy;
begin
  Self.tvWalkUpTo.Free;
  inherited;
end;

procedure TVehicleItem.SetWalkUpTo(avIndex: LongInt; avValue: TVehicleWalkUpToList);
begin
  if avIndex = mcWalkUpToIndex then
    Self.tvWalkUpTo.Assign(avValue);
end;

{ TVehicleList }

function TVehicleList.NewItem: TDLCustomDataObject;
begin
  Result := TVehicleItem.Create;
end;

end.